package com.dit.action.employee;

import org.springframework.beans.factory.annotation.Autowired;

import com.dit.action.AbstractAction;
import com.dit.entity.Employee;
import com.dit.service.EmployeeService;

public class AddNewEmployeeAction extends AbstractAction {
	
	@Autowired
	private EmployeeService employeeService;

	private Employee employee;
	
	private String id;
	
	public String viewAddEmployeePage() {
		return SUCCESS;
		
	}
	
	public String saveEmployee() {
		
		int status = employeeService.save(employee,  getSessionUserVariable().getId());
		
		if(status>0)
		{
			return SUCCESS;
		}
		else {
			return INPUT;
		}
		
		
	}
	
	
	

	public Employee getEmployee() {
		return employee;
	}

	public void setEmployee(Employee employee) {
		this.employee = employee;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	
}
